//********Rectangle class created by Niv

#ifndef _RECTANGLE_H_
#define _RECTANGLE_H_

#include "PointH.h"
#include <iostream>
#include <Windows.h>
#include "ScreenH.h"
#include "Shape.h"
using namespace std;

void gotoxy(int, int);

#define MAX_SCR_WID 80
#define MAX_SCR_LEN 25
#define MIN_SCR_WIDTH 0
#define MIN_SCR_LEN 0

class Rectangl: public Shape
{
	//If Adding Data members, Please remember to update the operator assignment "="
	int m_sizeX, m_sizeY;
	int exit_dir;
	Point m_TL, m_TR, m_BL, m_BR;
	bool bumped;

private:
	void drawRectangle(int option, Screen * s);
	

public:
	
    Rectangl() //Constructor*/
	{
	    init();
	}

	Rectangl(const Rectangl& copyObj) { *this = copyObj; }; //Copy Constructor

	Rectangl& operator=(const Rectangl& copyObj);

	void init();
	
	bool wasBumped(){return bumped;};
	
	void setBumped(bool value){bumped = value;};
	
	bool isEntirelyContained(Rectangl * rec); // does rec contained within this

	bool pointEntirelyInRectangle(int x, int y);

	void setPos(int x, int y);

	void resetPos(int x, int y);

	void getPos(int &x, int &y);

	void getSize(int &x, int &y);

	void getDir(int &x, int &y);

	void setSize(int x, int y);

	void setExitScreenDirection(int x){exit_dir=x;};
	
	void getExitScreenDirection(int &x){x = exit_dir;};

	void drawPoint(char c);

	void draw(int drawingOption = 1, Screen * s = NULL);

	bool isPointIn(int x, int y);
	
	void calcRectanglePoint();

	Point getPointTL();

	Point getPointTR();

	Point getPointBL();

	Point getPointBR();
	
	bool isEqual(Rectangl * rec);

	bool isInScreen(int x, int y);

	void firstResetPosForMove(float x, float y);

	 void setMoveRectangleWithClashes(int x, int y){};

	void printRectangleToScreenBuffer(int displayChoice, Screen * s);

	bool isOverlap(Rectangl * rec);

	bool isTangentFromOutside(Rectangl * rec);
	
	bool isTangentFromInside(Rectangl * rec);

	bool isContaining(Rectangl * rec);

	bool isRectangleTouchesRectangle(Rectangl * rec);

	bool isPointTouchesRectangle(int x, int y);

	bool isInScreen(Rectangl * r);

	bool isInScreen(Point p);

	void getPosPointByDirection(int &r_posX, int &r_posY, int r_dir_x, int r_dir_y, Rectangl * r);

	bool isDirectionsResetBorders();

};

#endif































